# -*- coding: utf-8 -*-
### Dabo Class Designer code. You many freely edit the code,
### but do not change the comments containing:
### 		'Dabo Code ID: XXXX',
### as these are needed to link the code to the objects.

## *!* ## Dabo Code ID: dButton-dForm-951
def onHit(self, evt):
	self.Form.cancel()



## *!* ## Dabo Code ID: dButton-dForm
def onHit(self, evt):
	self.Form.saveAndNew()



## *!* ## Dabo Code ID: dForm-top
def afterInit(self):
    mb = self.MenuBar
    fm = mb.getMenu("File")
    fm.prependSeparator()
    fm.prepend("Cancel", HotKey="Esc", OnHit=self.onCancel)
    fm.prepend("Save and New", HotKey="Ctrl+Shift+S", 
            OnHit=self.saveAndNew)
    fm.prepend("Save", HotKey="Ctrl+S", OnHit=self.onSave)
    self.requery()


def afterInitAll(self):
	clientBiz = self.getBizobj("clients")
	names, keys = clientBiz.getNamesAndKeys()
	names.insert(0, "--Please Select a Client--")
	keys.insert(0,0)
	self.ClientList.Choices = names
	self.ClientList.Keys = keys
#	self.ClientList.ValueMode = "Keys"
	
	self.requery()
	self.new()


def createBizobjs(self):
	hoursBizobj = self.Application.biz.HoursBizobj(self.Connection)
	self.addBizobj(hoursBizobj)
	
	clientBizobj = self.Application.biz.ClientBizobj(self.Connection)
	self.addBizobj(clientBizobj)


def saveAndNew(self):
    if self.save():
        # A failed save will return False. We only want to proceed if 
        # the save succeeds.
        self.new()
        self.serviceDate.setFocus()



## *!* ## Dabo Code ID: dButton-dForm-295
def onHit(self, evt):
	self.Form.save()


